import httpProxy from "../utils/request";
import { URL } from "../config";
export async function getForms(data: any) {
  return await httpProxy({
    url: `/admin/form/form/page`,
    method: "POST",
    data,
  });
}

export async function addFormApi(data: any) {
  return await httpProxy({
    url: `/admin/form/form/add`,
    method: "POST",
    data,
  });
}

export async function updateFormApi(data: any) {
  return await httpProxy({
    url: `/admin/form/form/update`,
    method: "POST",
    data,
  });
}

export async function deleteFormApi(ids: Array<number>) {
  return await httpProxy({
    url: `/admin/form/form/delete`,
    method: "POST",
    data: {
      ids: ids,
    },
  });
}
export async function getFormInfo(id: string) {
  return await httpProxy({
    url: `/admin/form/form/infoByPid?pid=${id}`,
    method: "GET",
  });
}
export async function getRecordForm(id: string) {
  return await httpProxy({
    url: `/admin/form/record/infoByPid?pid=${id}`,
    method: "GET",
  });
}
export async function updateRecordForm(data) {
  return await httpProxy({
    url: `/admin/form/record/update`,
    method: "POST",
    data,
  });
}
export async function getRecordFormByPerson(data) {
  return await httpProxy({
    url: `/admin/form/record/infoByPerson`,
    method: "POST",
    data,
  });
}
export async function saveRecordForm(data: any) {
  return await httpProxy({
    url: `/admin/form/record/add`,
    method: "POST",
    data,
  });
}
export async function joinUsers(data: any) {
  return await httpProxy({
    url: `/admin/form/form/joinUsers`,
    method: "POST",
    data,
  });
}
export async function getFormStatistics(data: any) {
  return await httpProxy({
    url: `/admin/form/form/statistics`,
    method: "POST",
    data,
  });
}

export async function deleteRecord(data) {
  return await httpProxy({
    url: `/admin/form/record/delete`,
    method: "POST",
    data,
  });
}

export async function getFormData(data: any) {
  return await httpProxy({
    url: `/admin/form/record/infoAll`,
    method: "POST",
    data,
  });
}

export async function userForms() {
  return await httpProxy({
    url: `/admin/form/form/user-forms`,
    method: "POST",
  });
}
